package com.xdtech.hotel.vo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.xdtech.common.utils.DateUtil;
import com.xdtech.common.utils.DateUtil.DateStyle;
import com.xdtech.core.model.BaseItem;
import com.xdtech.core.orm.utils.BeanUtils;
import com.xdtech.hotel.model.Customer;
import com.xdtech.hotel.util.HotelConstants;
import com.xdtech.web.freemark.item.GridColumn;

/**
 * 
 * @author max.zheng
 * @create 2015-04-04 11:08:36
 * @since 1.0
 * @see
 */
public class CustomerItem extends BaseItem implements Serializable{
	private static final long serialVersionUID = 1L;
	private Long id;
	@GridColumn(title="居住房号",width=70)
	private String roomNo;
	@GridColumn(title="房间类型",width=100,dictionaryCode="ROOM_TYPE")
	private String roomType;
	@GridColumn(title="姓名",width=70)
	private String name;
	@GridColumn(title="身份证号",width=100)
	private String cardId;
	@GridColumn(title="性别",formatter={"M=男","F=女"},width=100)
	private String sex;
	@GridColumn(title="状态",formatter={HotelConstants.CUSTOMER_LIVING_STATUS+"=入住",HotelConstants.CUSTOMER_LEAVE_STATUS+"=离开"},width=100)
	private String status;
	@GridColumn(title="入住时间",width=150)
//	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")   
	private Date createTime;
	@GridColumn(title="离开时间",width=150)
	private Date leaveTime;
	@GridColumn(title="房卡号",width=70)
	private String cardNo;
	@GridColumn(title="其他人信息",width=200)
	private String other;
	private Long roomId;
	

	public void setId(Long id) {
		this.id = id;
	}
	public Long getId() {
		return id;
	}
	
	public void setName(String name) {
		this.name = name;
		addQuerys("name", name);
	}
	public String getName() {
		return name;
	}
	
	public void setCardId(String cardId) {
		this.cardId = cardId;
		addQuerys("cardId", cardId);
	}
	public String getCardId() {
		return cardId;
	}
	
	public void setSex(String sex) {
		this.sex = sex;
		addQuerys("sex", sex);
	}
	public String getSex() {
		return sex;
	}
	public Date getCreateTime() {
		return createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
		addQuerys("createTime", DateUtil.getDate(createTime, DateStyle.YYYY_MM_DD_HH_MM_SS));
	}
	public String getStatus() {
		return status;
	}
	public void setStatus(String status) {
		this.status = status;
		addQuerys("status", status);
	}
	public Date getLeaveTime() {
		return leaveTime;
	}
	public void setLeaveTime(Date leaveTime) {
		this.leaveTime = leaveTime;
		addQuerys("leaveTime", DateUtil.getDate(leaveTime, DateStyle.YYYY_MM_DD_HH_MM_SS));
	}
	public Long getRoomId() {
		return roomId;
	}
	public void setRoomId(Long roomId) {
		this.roomId = roomId;
		addQuerys("roomId", roomId.toString());
	}
	public String getRoomNo() {
		return roomNo;
	}
	public void setRoomNo(String roomNo) {
		this.roomNo = roomNo;
		addQuerys("roomNo", roomNo);
	}
	public String getCardNo() {
		return cardNo;
	}
	public void setCardNo(String cardNo) {
		this.cardNo = cardNo;
		addQuerys("cardNo", cardNo);
	}
	public String getOther() {
		return other;
	}
	public void setOther(String other) {
		this.other = other;
	}
	public String getRoomType() {
		return roomType;
	}
	public void setRoomType(String roomType) {
		this.roomType = roomType;
	}
	/**
	 * 根据model构建vo
	 * 
	 * @author max
	 * @return
	 */
	public static CustomerItem createItem(Customer customer) {
		CustomerItem customerItem = new CustomerItem();
		BeanUtils.copyProperties(customerItem, customer);
		//自定义属性设置填充
		return customerItem;
	}
	/**
	 * 根据model集合创建vo集合
	 * 
	 * @author max
	 * @return
	 */
	public static List<CustomerItem> createItems(List<Customer> customers) {
		List<CustomerItem> customerItems = new ArrayList<CustomerItem>();
		for (Customer customer : customers) {
			customerItems.add(createItem(customer));
		}
		return customerItems;
	}
}
